/*
 * Copyright 2004 original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jbfilter.core;



/**
 * The common contract for all types of filters.
 * A filter is a grouping of {@link FilterComponent}s which compose the filter criteria to apply.
 * @author Marcus Adrian
 * @param <E> the type of the objects the filter is conceived for
 */
public interface Filter<E> extends FilterComponentContainer<E> {
	
	/**
	 * Creates a new filter handler for this filter. Filtering can be delegated in a generic way to
	 * this handler. This is necessary for facilities which use reflection like the jbfilter-jsp library.
	 * @return
	 */
	FilterHandler<E> newFilterHandler();
	/**
	 * Cleans all {@link FilterComponent}'s.
	 * This means resetting to the components default values, whatever
	 * that means for the specific component.
	 * <p>
	 * Concretely that means, calling {@link FilterComponent#clean()} on all components.
	 */
	void clean();

}
